<?php
include("conn.php"); 

  $mes = '';
  foreach ($result1 as &$row ){
  $nam = $row->title;
    $mes =$mes . ($nam . ':' . $_POST[$nam] . "<br />");
  }
  
    error_reporting(E_STRICT);
    date_default_timezone_set("Asia/Shanghai");//设定时区东八区
    require_once('assets/class.phpmailer.php');
    include("assets/class.smtp.php"); 
    $mail = new PHPMailer();               //new一个PHPMailer对象出来
    $body = eregi_replace("[\]",'',$mes);  //对邮件内容进行必要的过滤
    $mail->CharSet ="UTF-8";               //设定邮件编码，默认ISO-8859-1，如果发中文此项必须设置，否则乱码
    $mail->IsSMTP();                       // 设定使用SMTP服务
    $mail->SMTPDebug  = 1;                 // 启用SMTP调试功能
                                           // 1 = errors and messages
                                           // 2 = messages only
    $mail->SMTPAuth   = true;              // 启用 SMTP 验证功能
    $mail->SMTPSecure = $smtp_secure;      // 安全协议
    $mail->Host       = $host;             // SMTP 服务器
    $mail->Port       = $port;             // SMTP服务器的端口号
    $mail->Username   = $username;         // SMTP服务器用户名
    $mail->Password   = $password;         // SMTP服务器密码
    $mail->SetFrom($mail_from, $sender_name);
    $mail->Subject = $subject;
    $mail->MsgHTML($mes);
    $mail->AddAddress($to, $recepter_name);
    if(!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo " <script language=\"javascript\">history.go(-1)</script>";
    }
?>
